const express = require('express');
const app = express();
app.use(express.static('./public'));
const util = require('util');
const formidable = require('formidable');  
app.post('/data',(req,res)=>{
  var form = new formidable.IncomingForm();
  form.parse(req, function(err, fields, files) {
    res.writeHead(200, { 'content-type': 'text/plain' });
    res.write('received upload:\n\n');
    res.end(util.inspect({ fields: fields, files: files }));
  });
})
app.listen(3000);
console.log('正在监听端口3000,http://127.0.0.1:3000')